package com.company.jvm;

public class JavaVMStackOOM {
    private void dontStop(){
        try {
            Thread.sleep(100000);
        }catch (Exception ex){

        }
    }

    public void stackLeakByThread(){

        while (true){
            Thread thread=new Thread(new Runnable() {
                @Override
                public void run() {
                    dontStop();
                }
            });

            thread.start();
        }
    }

    public static void main(String[] args) {
        JavaVMStackOOM oom=new JavaVMStackOOM();
        oom.stackLeakByThread();
    }
}
